<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
  <script>
    // 1. 用户决定学生数量
    // 2. 有几个学生，就要输入几次成绩
    // 3. 求学生成绩总和， 求平均分

    var count = parseInt( prompt('请输入学生数量') )   
    var sum = 0

    for(var i = 1; i <= count; i++) {
      var score = prompt('请输入第' + i + '个学生成绩')

      sum = sum + parseFloat(score)
    }

    console.log(sum, sum / count)

  </script>
</body>
</html>